import Page
from Page import Service
from Base.Base import Base
from selenium.webdriver.common.by import By


class ServiceCustomerHotlinePage(Base):
    """
    客服热线页
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 左侧的home键
        self.driving_home_btn = (By.XPATH, Service.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.driving_back_btn = (By.XPATH, Service.RESOURCE_ID.format('ivBack'))

        # 提示
        self.driving_tip_text = (By.XPATH, Service.RESOURCE_ID.format("confirm_dialog_title"))

        # 客服热线内容
        self.driving_customer_service_hotline_text = (By.XPATH, Service.RESOURCE_ID.format("confirm_dialog_content"))

        # 确认按钮
        self.driving_sure_btn = (By.XPATH, Service.RESOURCE_ID.format("btn_confirm_sure"))

        # 取消按钮
        self.driving_cancel_btn = (By.XPATH, Service.RESOURCE_ID.format("btn_confirm_cancel"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.driving_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.driving_back_btn)

    def get_tip(self):
        """
        获取客服热线标题

        :return:获取元素
        """
        return self.find_element_o(self.driving_tip_text)

    def get_customer_service_hotline(self):
        """
        获取客服热线内容

        :return:获取元素
        """
        return self.find_element_o(self.driving_customer_service_hotline_text)

    def click_sure(self):
        """
        点击确认按钮

        :return:None
        """
        self.click_element(self.driving_sure_btn)

    def click_cancel(self):
        """
        点击取消按钮

        :return:None
        """
        self.click_element(self.driving_cancel_btn)

    def is_display_customer_hotline(self):
        """
        是否进入客服热线界面

        :return: bool
        """
        return self.is_display(self.driving_tip_text)
